package com.xuqi.W3;

import java.io.UnsupportedEncodingException;

import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;

public class W3Simple
{
	private static final String TAG = "W3Simple";
	private static W3 connect = null;
	private static W3Request downParam = null;

	public static String GetMethodwithReturn(String url)
	{
		if (connect == null)
		{
			connect = new W3();
		}
		connect.initW3();
		if (downParam == null)
		{
			downParam = new W3Request();
		}

		downParam.setMethod(W3Request.W3_REQ_METHOD_GET);
		downParam.setURL(url);
		downParam.setSendHeaders(null);

		downParam.setReceiveDataToBuffer();

		byte[] strGetString = null;
		boolean brt = (W3.W3_ERR_NO_ERROR == connect.doW3Action(downParam));
		if (brt)
		{
			strGetString = connect.getResponse().getResponseData();
		}
		String outString = "";
	
		outString = new String(strGetString);
		
		Log.d(TAG, outString);
		downParam = null;
		connect = null;
		return outString;

	}

}
